24 #define foreach(x, v) for (typeof (v).begin() x=(v).begin(); x !=(v).end(); ++x)
25 #define For(i, a, b) for (int i=(a); i<(b); ++i)
26 #define D(x) cout << #x " is " << x << endl
35 if (memo
[n
][s
] != -1) return memo
[n
][s
];
38 for (int i
= 0; i
< n
; ++i
) {
39 int option
= 1 + max( f(i
, s
-1), f(n
-i
-1, s
) );
40 best
= min(best
, option
);
42 return memo
[n
][s
] = best
;
48 memset(memo
, -1, sizeof memo
);
52 assert(s
> 0 and n
> 0);